package at.kaok.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import at.kaok.gui.panels.LoginPanel;
import at.kaok.gui.panels.MenuePanel;
import at.kaok.gui.panels.SelectGamePanel;

public class BetFrame extends JFrame{

	private MenuePanel pnlMenu;
	private JComponent pnlMain;
	private static String session;
	
	
	
	public static String getSession() {
		return session;
	}

	public static void setSession(String session) {
		BetFrame.session = session;
	}

	private static BetFrame thisObj = null;

	/**
	 * Launch the application.
	 */
	public static void start() {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					
					BetFrame window = new BetFrame();
					thisObj = window;
					Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
					window.setVisible(true);
					int w = 500;
					int h = 500;
					int x = (dim.width-w)/2;
					int y = (dim.height-h)/2;
					window.setBounds(x, y, w, h);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public BetFrame() {
		
		initialize();
	}
	
	public static BetFrame getInstance(){
		return thisObj;
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		pnlMenu = new MenuePanel();
		pnlMain = new JPanel();
		pnlMain.add(new JLabel("started"));
		this.setLayout(new BorderLayout());
		this.add(pnlMain,BorderLayout.CENTER);
		this.add(pnlMenu,BorderLayout.WEST);

		
	}
	
	public void setMainPanel(JComponent comp){
		this.remove(pnlMain);
		this.pnlMain = comp;
		this.add(pnlMain,BorderLayout.CENTER);
		this.validate();
		this.repaint();
		
		
	}

	
	

}
